home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
dialogic.zip
/
EXAMPLE.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-01-31
|
5KB
|
118 lines
'
'┌───────────────────────────────────────────────────────┐
'│ Written by Jonathan S. Waldman │
'│ (C) 1989, 1990 Jonathan S. Waldman & Dialog Software │
'│ (C) Crescent Software. │
'│ All rights reserved. │
'└───────────────────────────────────────────────────────┘
'EXAMPLE1.BAS - This will serve as a prototype for most of the dialog boxes
' you will need to generate.
'
'This program demonstrates the use of a single-tasking unstacked dialog boxes.
' When you run this, you may enter a search string and select various
' options. If you choose <Help> a new dialog box will appear with help
' text. When you are finished reading the help, you may close the dialog
' box by pressing <Enter>. At this point, this program will re-generate
' the Search dialog box by filling it with all the options you chose before
' <Help> was requested. The primary dialog box (Search, in this case) will
' continue to appear until Help is NOT chosen or until <Esc> is pressed.
'
'Please notice that this example defines some strings at the beginning, such
' as Cancel$ and Help$. You should also notice that the Find template
' uses these strings in the command button definitions. Further, other
' variables, such as Search$ and WholeWords, are used to set a re-generated
' Find dialog box to its previously-set values.
DEFINT A-Z
'$INCLUDE: 'DIALOGIC.BI' 'include DiaLogic's TYPE definitions
CALL InitMouse(There%)
IF There% THEN
CALL ShowCursor 'show the mouse
CALL TextCursor(0, 4) 'use this to insure mouse cursor is visible
END IF
WIDTH , 25 'insure we're in 25-line mode
CLS 'clear the screen
'$DYNAMIC 'make all arrays dynamic
MaxDBE = 20 'use for our dimension statements
' 20 dialog box elements will be our max
Cancel$ = CHR$(27) 'these are our string assignments, also used
Help$ = CHR$(0) + CHR$(59) ' in the FIND.DB template.
OK$ = CHR$(13)
Search$ = "" 'initialize Search$ to null
ExitLoop = 0 'stay in loop until <OK> or <Cancel> is
' chosen
DO
REDIM SHARED DB(2, MaxDBE) AS DialogType 'REDIM these TYPE arrays
REDIM SHARED LB(0) AS DialogText ' as dynamic
Level% = 1 'set Level% to 1
'$INCLUDE: 'SEARCH.DB' 'then include our dialog box template
DB(Level%, 2).TextString = Search$
Action% = 0 'set Action% to 0
Focus% = 0 'set the input focus to auto -- 0
CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$) 'Call DiaLogic
'When program execution returns here the dialog box already will have been
' cleared from the screen. If <Help> is chosen we'll generate a Help
' dialog box. We'll also check to see if <Esc> was pressed or if <OK>
' was entered, in which case we can get the search string and conduct
' a search.
'Now we can store dialog box information in local variables. These
' variables also appear in the template definition.
Search$ = MID$(DB(Level%, 2).TextString, 1, DB(Level%, 2).NumberOne)
MatchCase = DB(Level%, 3).Default '-1 if Match Case check box is checked
WholeWord = DB(Level%, 4).Default '-1 if Whole Words is checked
SearchType = DB(Level%, 5).Default '1 for Active Window, 2 for Current
' Module, 3 for All Modules
COLOR 7, 0
SELECT CASE Ky$
CASE Cancel$ '<Cancel> pressed
PRINT "You pushed <Cancel>."
ExitLoop = -1
CASE Help$
REDIM SHARED DB(2, MaxDBE) AS DialogType 'REDIM these TYPE arrays as dynamic
REDIM SHARED LB(10) AS DialogText
Level% = 1 'set Level% to 1
'$INCLUDE: 'SEARCHH.DB' 'then include our dialog box template
Action% = 0 'set Action% to 0
Focus% = 0 'set the input focus to auto -- 0
CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$) 'Call DiaLogic
CASE OK$
PRINT "You pushed <OK>."
ExitLoop = -1
CASE ELSE
BEEP
END SELECT
LOOP UNTIL ExitLoop
CALL HideCursor
COLOR 7, 0
CLS
PRINT "Your search string is " + Search$ + "."
IF MatchCase THEN
PRINT "Match Upper/Lower Case was checked."
END IF
IF WholeWord THEN
PRINT "Whole Words Only was checked."
END IF
END